
var runUpdatePassword = function (run, $, layer) {
    if (!run) return;

    var timer = setInterval(function () {
        //location.reload();
    }, 1000);

    layer.alert(123);

    $.ajax({
        url: './all.html'
        , beforeSend: function () {
            //layer.ready(function(){
            //layer.load();
            //});
        }
        , success: function () {
            return;
            layer.closeAll('loading', function () {
                setTimeout(function () {
                    if ($('.layui-layer-loading').length) {
                        console.error('layer close 异常');
                        clearInterval(timer);
                    }
                }, 200);
            });
        }
    });
};
window.jQuery && runUpdatePassword(1, window.jQuery, window.layer);

layui.use('layer', function () {
    var $ = layui.jquery, layer = layui.layer;

    //触发事件
    var active = {
        updatePassword: function () {
            layer.open({
                type: 2
                , title: '修改密码'
                , content: '../common/updatePassword.html'
                , area: ['900px', '330px']
                , maxmin: false //取消最大化按钮
            });
        }
        ,personalInformation: function () {
            layer.open({
                type: 2
                , title: '修改个人信息'
                , content: '../common/personalInformation.html'
                , area: ['900px', '520px']
                , maxmin: false //取消最大化按钮
            });
        }

    };

    $('.demo').on('click', function () {
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });
});
